package com.oba.king.sysmanager;

import java.util.List;

import com.oba.base.dao.BaseDao;
import com.oba.base.interfaces.IHsqlBuilder;

public class UserGroupDao extends BaseDao {

	public IHsqlBuilder buildAll() {
		return getSqlBuilder("from UserGroup order by name");
	}

	public IHsqlBuilder buildByCondition(Dept dept, String userGroupName) {
		IHsqlBuilder sql = getSqlBuilder("from UserGroup ug");
		sql.add("ug.dept = ?", dept);
		sql.add("ug.name like ?", userGroupName, "%", "%");
		sql.addend("order by ug.name");
		return sql;
	}

	public List<Dept> findAllDept() {
		return find("from Dept order by serial");
	}

}
